var e = require;
var t = module;
var n = exports;
("use strict");
var o,
  i =
    (this && this.__extends) ||
    ((o = function (e, t) {
      return (o =
        Object.setPrototypeOf ||
        ({ __proto__: [] } instanceof Array &&
          function (e, t) {
            e.__proto__ = t;
          }) ||
        function (e, t) {
          for (var n in t)
            Object.prototype.hasOwnProperty.call(t, n) && (e[n] = t[n]);
        })(e, t);
    }),
      function (e, t) {
        function n() {
          this.constructor = e;
        }
        o(e, t),
          (e.prototype =
            null === t
              ? Object.create(t)
              : ((n.prototype = t.prototype), new n()));
      }),
  r =
    (this && this.__decorate) ||
    function (e, t, n, o) {
      var i,
        r = arguments.length,
        y =
          r < 3
            ? t
            : null === o
              ? (o = Object.getOwnPropertyDescriptor(t, n))
              : o;
      if ("object" == typeof Reflect && "function" == typeof Reflect.decorate)
        y = Reflect.decorate(e, t, n, o);
      else
        for (var a = e.length - 1; 0 <= a; a--)
          (i = e[a]) &&
            (y = (r < 3 ? i(y) : 3 < r ? i(t, n, y) : i(t, n)) || y);
      return 3 < r && y && Object.defineProperty(t, n, y), y;
    };
Object.defineProperty(n, "__esModule", { value: !0 });
var y,
  a = e("EventConst"),
  s = e("PlatformConst"),
  c = e("PopupConst"),
  x = e("SceneConst"),
  l = e("EventManager"),
  h = e("PlatformManager"),
  d = e("PopupManager"),
  u = e("ResManager"),
  f = e("SceneManager"),
  p = e("ConfigUtils"),
  t = cc._decorator,
  e = t.ccclass,
  t = t.property,
  e =
    ((y = cc.Component),
      i(g, y),
      (g.prototype.onLoad = function () {
        var e = h.Platform.getConfig(),
          t = e.ageTipType;
        t != s.AgeTipType.NO &&
          ((this.age.getComponent(cc.Sprite).spriteFrame =
            this.ageSpriteFrame[t]),
            (this.age.active = !0)),
          e.hasCopyright && (this.copyright.active = !0),
          (this.logo.spriteFrame = this.logoSpriteFrame[e.logoType]);
      }),
      (g.prototype.onEnable = function () {
        cc.sys.localStorage.setItem("loginSuccess", 0)
        window.__prv.qgLogin(() => {
          window.__prv.showLoginSuccessTip()
          l.Event.on(a.default.ENTER_MAIN, this.enterMain, this);
        }, () => {
          window.__prv.showLoginUI()
          setInterval(() => {
            if (parseInt(cc.sys.localStorage.getItem("loginSuccess")) == 1) {
              this.enterMain()
              cc.sys.localStorage.setItem("loginSuccess", 0)
            }
          }, 500);
        })
        l.Event.on(a.default.ENTER_MAIN, this.enterMain, this);
      }),
      (g.prototype.onDisable = function () {
        l.Event.off(a.default.ENTER_MAIN, this.enterMain, this);
      }),

      (g.prototype.enterMain = function () {
        setTimeout(() => {
          console.error("enterMain: ", h.Platform.getConfig().loadingDelay);
          var n = this;
          window.__prv.doAction("loading结束强弹视频广告", ['hw']);
          if (window.__prv && !(window.__prv.getChannel() == 'vivo' || window.__prv.getChannel() == 'oppo' || window.__prv.getChannel() == 'hw')) {
            cc.sys.localStorage.setItem("superBrain_privacypolicy", 1)
          }
          cc.sys.localStorage.getItem("superBrain_privacypolicy")
            ? this.scheduleOnce(function () {
              console.error("getLevelIdBy Index");
              p.ConfigUtils.getLevelIDByIndex(0, 1, function (e) {
                console.error("加载场景值: ", e);
                u.Res.load("zqddn_zhb/prefab/level/zqddn_zhb_level" + e).then(
                  function () {
                    console.log("预加载成功"),
                      f.Scene.loadScene(x.SceneConst.MAIN);
                  }
                );
              });
              // }, h.Platform.getConfig().loadingDelay)
            }, 0.1)
            : cc.resources.load("privacyWin", function (e, t) {
              if (e) return console.error("", e);
              t = cc.instantiate(t);
              n.node.addChild(t),
                t.getComponent("crtPrivacyWin").open(function () {
                  f.Scene.loadScene(x.SceneConst.MAIN);
                  window.__prv.doAction("同意隐私政策强弹视频", ['hw']);
                });
            });
        }, 2000); //back

      }),
      (g.prototype.clickAge = function () {
        d.Popup.show(c.PopupConst.AGE_TIP);
      }),
      r([t(cc.Node)], g.prototype, "age", void 0),
      r([t(cc.Node)], g.prototype, "copyright", void 0),
      r([t([cc.SpriteFrame])], g.prototype, "ageSpriteFrame", void 0),
      r([t(cc.Sprite)], g.prototype, "logo", void 0),
      r([t([cc.SpriteFrame])], g.prototype, "logoSpriteFrame", void 0),
      r([e], g));
function g() {
  var e = (null !== y && y.apply(this, arguments)) || this;
  return (
    (e.age = null),
    (e.copyright = null),
    (e.ageSpriteFrame = []),
    (e.logo = null),
    (e.logoSpriteFrame = []),
    e
  );
}
n.default = e;
